import { Component, OnInit } from '@angular/core';
import { Audience, Episode, Express, Scene } from 'src/classes/entities';
import { StoreService } from 'src/services/store.service';
import { UiService } from 'src/services/ui.service';

@Component({
  selector: 'app-expresslistview',
  templateUrl: './expresslistview.component.html',
  styleUrls: ['./expresslistview.component.scss']
})
export class ExpresslistviewComponent implements OnInit {

  constructor(public ui: UiService, public store: StoreService) { }

  ngOnInit(): void {
  }
  currentExpand = {
    'audience': true,
    'episode': true,
    'scene': true
  }
  select(item, t) {
    console.log(item);
    console.log(t);
    this.store.currentEntity = item
    if (t == 'panorama' || t === 'express')
      this.ui.openinfo(item.Name, t, item)
    else
      this.ui.openinfo(item.Id, t, item)
  }
  active(item) {
    console.log(item);
    this.ui.activePanel = item
  }
  add(item: Express, t) {
    if (t === 'Audience')
      item.Audiences.push(new Audience())
    if (t === 'Episode')
      item.Episodes.push(new Episode())
    if (t === 'Scene')
      item.Scenes.push(new Scene())

  }
}
